--- title: OpenHSI Camera Implementations keywords: fastai sidebar: home_sidebar summary: "Hardware cameras" description: "Hardware cameras" nb_path: "nbs/02_cameras.ipynb" ---
with WebCamera(mode="HgAr", n_lines=64, processing_lvl = 0) as cam:
cam.collect()
fig = cam.show(hist_eq=True)
fig
plt.subplots(figsize=(12,4))
plt.imshow(cam.dc.data[:,1,:],cmap="gray",
extent=[cam.settings["index2wavelength_range"][0],cam.settings["index2wavelength_range"][1],0,cam.dc.size[0]],
aspect=0.3)
Used for the OpenHSI Camera Mark I with a Ximea detetor (with IMX252 sensor, e.g. MX031CG-SY).
Make sure you install the Ximea API beforehand in the instructions https://www.ximea.com/support/wiki/apis/Python
def run_ximea():
with XimeaCamera(n_lines=128, processing_lvl = -1, pkl_path="",json_path='../assets/cam_settings_ximea.json') as cam:
cam.start_cam()
for i in tqdm(range(cam.n_lines)):
cam.put(cam.get_img())
cam.stop_cam()
%prun run_ximea()
#fig = cam.show(robust=True)
#fig
Used for the OpenHSI Camera from Sydney Photonics.
Make sure you installthe Lucid Vision Labs Arena SDK and python api beforehand. These can be found here https://thinklucid.com/downloads-hub/
Any keyword-value pair arguments must match the those avaliable in settings file. LucidCamera expects the ones listed below:
binxy: number of pixels to bin in (x,y) directionwin_resolution: size of area on detector to readout (width, height)win_offset: offsets (x,y) from edge of detector for a selective exposure_ms: is the camera exposure time to usepixel_format: format of pixels readout sensor, ie Mono8, Mono10, Mono10Packed, Mono12, Mono12Packed, Mono16mac_addr: The mac address of the GigE sensor as string i.e. "1c:0f:af:01:7b:a0"json_path='cals/OpenHSI-07/OpenHSI-07_settings_Mono8_bin1.json'
pkl_path='cals/OpenHSI-07/OpenHSI-07_calibration_Mono8_bin1.pkl'
with LucidCamera(n_lines=1000,
processing_lvl = 2,
pkl_path=pkl_path,json_path=json_path,
exposure_ms=10
) as cam:
cam.collect()
# cam.start_cam()
# img = cam.get_img()
# cam.stop_cam()
cam.show(hist_eq=True)
# hv.Image(img, bounds=(0,0,*img.shape)).opts(xlabel="wavelength index",ylabel="cross-track",cmap="gray",title="test frame",width=400,height=400)
cam.show(hist_eq=True)
Follow the install instructions for https://pypi.org/project/simple-pyspin/. This includes the Spinnaker SDK and the Python pyspin .whl file from https://flir.app.boxcn.net/v/SpinnakerSDK. {% include note.html content='PySpin only supports Python2.7/3.6-3.8' %} There are some additional settings:
win_resolution: size of area on detector to readout (width, height)win_offset: offsets (x,y) from edge of detector for a selective exposure_us: is the camera exposure time to use in microsecondsjson_path='assets/cam_settings_flir.json'
pkl_path='assets/cam_calibration_flir.pkl'
with FlirCamera(n_lines=1000,
processing_lvl = 2,
pkl_path=pkl_path,json_path=json_path,
) as cam:
cam.collect()
fig = cam.show(hist_eq=True)
fig